home *** CD-ROM | disk | FTP | other *** search
Text File | 1991-03-06 | 3.8 KB | 107 lines | [TEXT/GEOL] |
- Item 6889313 29-May-90 18:38PDT
-
- From: D1974 NorthWest Rsch Assoc, D Lucas,PRT
-
- To: MACAPP.TECH$ MacApp Technical
-
- cc: MACAPP.TEST MacApp SQA Team
- SCHMUCKER1 Schmucker, Kurt
- D1974 NorthWest Rsch Assoc, D Lucas,PRT
-
- Sub: EraseRect problems
-
- I would appreciate ideas on a couple of problems I have run into while
- converting my app from ß9 to 2.0. The first problem involves the Draw and
- DrawContents methods of TWindow. In ß9, TWindow.Draw did only one thing: it
- called EraseRect to clear its area. This caused a lot of unneccessary (and
- visually annoying) screen clearing and drawing at update time, and in my ß9
- version I had overriden this method to do nothing, which worked fine. In 2.0,
- TWindow.Draw does nothing, and the EraseRect has been moved to
- TWindow.DrawContents as follows (code conditioned on
- qExperimentalAndUnsupported has been deleted):
-
- PROCEDURE TWindow.DrawContents; OVERRIDE;
- VAR
- visRect: Rect;
-
- PROCEDURE DoDrawContents;
-
- VAR
- visRect: Rect;
-
- BEGIN
- IF Focus THEN
- BEGIN
- GetVisibleRect(visRect);
- EraseRect(visRect);
- INHERITED DrawContents;
- IF fIsResizable THEN
- DrawResizeIcon;
- END;
- END;
-
- BEGIN
- DoDrawContents;
- END;
-
- The inheritted DrawContents is TView.DrawContents, which tells all subviews to
- Draw themselves and send their subviews the DrawContents message. Here's my
- problem: If I override TWindow.DrawContents to skip the EraseRect, there is no
- way to call TView.DrawContents. I would like to call INHERITED INHERITED
- DrawContents, but of course the language doesn't support this. I have a kludgy
- solution, which is to define a new method, TMyWindow.MyInheritedDrawContents,
- which is just a copy of TView.DrawContents. Then my override of
- TWindow.DrawContents is
-
- PROCEDURE TMyWindow.DrawContents; OVERRIDE;
- VAR
- visRect: Rect;
-
- PROCEDURE DoDrawContents;
-
- BEGIN
- IF Focus THEN
- BEGIN
- SELF.MyInheritedDrawContents;
- IF fIsResizable THEN DrawResizeIcon;
- END;
- END;
-
- BEGIN
- DoDrawContents;
- END;
-
- This works, but surely there is a better way. Perhaps this is a bug. Why
- wasn't the EraseRect left in TWindow.Draw, where it could be avoided with a
- simple override? Or am I missing something obvious? Incidentally, the release
- notes for 2.0 makes no mention of these changes from ß9.
-
- My second problem also has to do with EraseRect, but, ironically, in this case
- 2.0 doesn't clear the screen where it should, in contrast to the case above.
- It all revolves around the Draw, ImageText, and SetText methods of TStaticText.
- I have a TStaticText installed on top of another view that clears the screen to
- a dark gray in its Draw method. I want the TStaticText to display its text on
- a white background surrounded by gray. This worked fine in ß9, apparently
- because Draw called ImageText which called the toolbox procedure TextBox, which
- cleared the backgound to the current background color, which for me was white.
- Now I find that 2.0 has replaced the call to TextBox by a call to MATextBox,
- which seems to display its text without clearing the background. So when the
- window first appears I get unreadable black text on a dark gray background. It
- may happen that the text will change, in which case I call SetText, which does
- an EraseRect before calling Draw! Then the updated text becomes the desired
- black on white.
-
- Do I have to override TStaticText to get the desired behavior? Why was this
- changed from ß9? Again, none of this is mentioned in the release notes where
- the changes since ß9 are listed.
-
- Thanks for any ideas or comments you may have. Please link them to me at
- D1974, as I am not tracking MACAPP.TECH$.
-
- Dave Lucas,
- Visualogic, Inc.
-
-
-
-
-